<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class SupplierAuthentication extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules(): array
    {
        return [
            'supplier_id'           => 'required|integer',
            'id_photo'              => 'required',
            'id_card_front_photo'   => 'required',
            'id_card_reverse_photo' => 'required',
            'business_license'      => 'required',
        ];
    }

    /**
     * @return array
     */
    public function messages(): array
    {
        return [
            'supplier_id.required'           => '请选择供应商',
            'supplier_id.integer'            => '非法参数',
            'id_photo.required'              => '请上传手持身份证照片',
            'id_card_front_photo.required'   => '请上传份身份证正面照',
            'id_card_reverse_photo.required' => '请上传份身份证背面照',
            'business_license.required'      => '请上传营业执照',
        ];
    }
}
